//package cc.vv.baselibrary.activity.deliveryAddress;
//
//import android.app.Dialog;
//import android.content.Intent;
//import android.database.Cursor;
//import android.graphics.drawable.StateListDrawable;
//import android.net.Uri;
//import android.os.Bundle;
//import android.provider.ContactsContract;
//import android.support.annotation.Nullable;
//import android.text.Editable;
//import android.text.TextUtils;
//import android.text.TextWatcher;
//import android.view.View;
//import android.widget.EditText;
//import android.widget.LinearLayout;
//import android.widget.TextView;
//
//import java.util.ArrayList;
//import java.util.HashMap;
//import java.util.List;
//import java.util.Map;
//import java.util.Set;
//
//import cc.vv.baselibrary.R;
//import cc.vv.baselibrary.activity.BaseActivity;
//import cc.vv.baselibrary.api.BaseLibNetworkInterface;
//import cc.vv.baselibrary.bean.DeliveryAddress.request.CommonDeliveryAddressRequestObj;
//import cc.vv.baselibrary.bean.DeliveryAddress.response.AddDeliveryAddressResponseObj;
//import cc.vv.baselibrary.bean.DeliveryAddress.response.UpdateDeliveryAddressResponseObj;
//import cc.vv.baselibrary.bean.PublicViewHolder;
//import cc.vv.baselibrary.bean.base.BaseResponseObj;
//import cc.vv.baselibrary.db.daTable.DeliveryAddressBean;
//import cc.vv.baselibrary.global.BCSharePreKey;
//import cc.vv.baselibrary.http.BaseHttpRequest;
//import cc.vv.baselibrary.server.DeliveryAddressRelatedServer;
//import cc.vv.baselibrary.util.BCColorSetBackgroundUtil;
//import cc.vv.baselibrary.util.BaseResourceUtil;
//import cc.vv.baselibrary.util.ColorUtil;
//import cc.vv.baselibrary.util.LKAppUtil;
//import cc.vv.baselibrary.util.LKCommonUtil;
//import cc.vv.baselibrary.util.LKDialogUtil;
//import cc.vv.baselibrary.util.LKLogUtil;
//import cc.vv.baselibrary.util.LKPrefUtil;
//import cc.vv.baselibrary.util.LKToastUtil;
//import cc.vv.baselibrary.util.StringProcessingUtil;
//import cc.vv.baselibrary.util.remind.EditTextInputRuleUtil;
//import cc.vv.baselibrary.view.BaseTopBarView;
//import cc.vv.baselibrary.view.edittext.TelEdittext;
//import cc.vv.baselibrary.view.imgselector.utils.LKPermissionUtil;
//import cc.vv.baselibrary.view.pickerview.ProvincesCitySelectView;
//
///**
// * 添加收货地址
// * Created by sun.li on 2017/7/11.
// *
// * @author sun.li
// */
//public class AddOrEditorDeliveryAddressActivity extends BaseActivity {
//
//    /**
//     * 地址编辑标志Key
//     */
//    public static final String AddressEditorLogoKey = "AddressEditorLogoKey";
//
//    /**
//     * 地址新增标志Key
//     */
//    public static final String AddressAddLogoKey = "AddressAddLogoKey";
//
//    /**
//     * 管理或选择界面跳转标志Key
//     */
//    public static final String ManageOrSelectSkipLogoKey = "ManageOrSelectSkipLogoKey";
//
//    /**
//     * 新增或编辑地址界面跳转新界面Code
//     */
//    public static final int AddOrEditorDeliveryAddressCode = 1002;
//
//
//    /**
//     * 收货地址对象实体
//     */
//    private DeliveryAddressBean deliveryAddressBean;
//
//    /**
//     * 管理或选择界面跳转标志
//     */
//    private String manageOrSelectSkipLogo = "";
//
//
//    @Override
//    protected int initLayoutRes() {
//        return R.layout.activity_add_delivery_address;
//    }
//
//    private ViewHolder viewHolder;
//
//    private class ViewHolder extends PublicViewHolder {
//
//
//        /**
//         * 标题栏标题
//         */
//        private BaseTopBarView jtb_aoedaa_top_bar;
//
//        /**
//         * 收货人姓名
//         */
//        private EditText et_aoedaa_user_name;
//        /**
//         * 手机号码
//         */
//        private TelEdittext et_aoedaa_phone;
//        /**
//         * 省、市、区
//         */
//        EditText et_aoedaa_city;
//        /**
//         * 详细地址
//         */
//        private EditText et_aoedaa_address_detailed;
//        /**
//         * 家按钮（标签）
//         */
//        TextView tv_dali_label_home;
//        /**
//         * 公司按钮（标签）
//         */
//        TextView tv_dali_label_company;
//        /**
//         * 学校按钮（标签）
//         */
//        TextView tv_dali_label_school;
//
//        /**
//         * 新的标签按钮（容器）
//         */
//        private LinearLayout ll_dali_label_new_layout;
//        /**
//         * 新的标签按钮（标签）
//         */
//        TextView tv_dali_label_new;
//        /**
//         * 增加按钮（标签）
//         */
//        TextView tv_dali_increase_label;
//        /**
//         * 编辑（标签）
//         */
//        TextView tv_dali_alter_label;
//        /**
//         * 编辑新增标签按钮容器
//         */
//        private LinearLayout ll_dali_editor_label_layout;
//        /**
//         * 增加标签输入框
//         */
//        private EditText et_dali_editor_label;
//        /**
//         * 添加按钮（标签）
//         */
//        TextView tv_dali_add_label;
//
//        /**
//         * 保存并使用按钮文本框
//         */
//        private TextView tv_aoedaa_save_delivery_address;
//
//        LinearLayout ll_aoedaa_save_delivery_address;
//
//
//    }
//
//    @Override
//    protected PublicViewHolder initViewHolderObject() {
//        viewHolder = new ViewHolder();
//        return viewHolder;
//    }
//
//
//    @Override
//    protected void initView(@Nullable Bundle bundle) {
//        super.initView(bundle);
//        StateListDrawable drawable = BCColorSetBackgroundUtil.addStateListBgDrawableRadius1(LKPrefUtil.getInt(BCSharePreKey.THEME_MAIN_COLOR, ColorUtil.setBCColor(R.color.color_28BFA9)), 4);
//        viewHolder.ll_aoedaa_save_delivery_address.setBackground(drawable);
//
//
//    }
//
//    @Override
//    protected void baseOnClick(int viewId) {
//        if (BaseResourceUtil.whetherResourceIDSame(viewId, R.id.et_aoedaa_city)) {
//            LKAppUtil.getInstance().closeInput(this, viewHolder.et_aoedaa_city);
//            if (addressSelectDialog != null) {
//                addressSelectDialog.show();
//            }
//        } else if (BaseResourceUtil.whetherResourceIDSame(viewId, R.id.ll_aoedaa_save_delivery_address)) {
//            //保存收货地址按钮
//            buildDeliveryAddressBean();
//                /* 收货地址信息完整有效性判断信息*/
//            String validityJudgmentMsg = DeliveryAddressRelatedServer.getInstance().deliveryAddressInfoValidityJudgment(deliveryAddressBean);
//            if (TextUtils.isEmpty(validityJudgmentMsg.trim())) {
//                //请求服务器
//                if (manageOrSelectSkipLogo.equals(ManageDeliveryAddressActivity.ManageDeliveryAddressActivityLogo_add)) {
//                    addAddress();
//                } else if (manageOrSelectSkipLogo.equals(ManageDeliveryAddressActivity.ManageDeliveryAddressActivityLogo_update)) {
//                    updateAddress();
//                } else if (manageOrSelectSkipLogo.equals(SelectDeliveryAddressActivity.SelectDeliveryAddressActivityLogo)) {
//                    addAddress();
//                }
//            } else {
//                LKToastUtil.showToastShort(validityJudgmentMsg);
//            }
//        } else if (BaseResourceUtil.whetherResourceIDSame(viewId, R.id.tv_dali_label_home)) {
//            //家标签选中
//            setAllLabelStyle(viewHolder.tv_dali_label_home.getText().toString().trim());
//        } else if (BaseResourceUtil.whetherResourceIDSame(viewId, R.id.tv_dali_label_company)) {
//            //公司标签选中
//            setAllLabelStyle(viewHolder.tv_dali_label_company.getText().toString().trim());
//
//        } else if (BaseResourceUtil.whetherResourceIDSame(viewId, R.id.tv_dali_label_school)) {
//            //学校标签选中
//            setAllLabelStyle(viewHolder.tv_dali_label_school.getText().toString().trim());
//        } else if (BaseResourceUtil.whetherResourceIDSame(viewId, R.id.tv_dali_label_new)) {
//            //修改按钮点击（标签）
//            setAllLabelStyle(viewHolder.tv_dali_label_new.getText().toString().trim());
//        } else if (BaseResourceUtil.whetherResourceIDSame(viewId, R.id.tv_dali_increase_label)) {
//            //增加按钮点击（标签）
//            viewHolder.ll_dali_label_new_layout.setVisibility(View.GONE);
//            viewHolder.tv_dali_increase_label.setVisibility(View.GONE);
//            viewHolder.ll_dali_editor_label_layout.setVisibility(View.VISIBLE);
//            viewHolder.et_dali_editor_label.setText(viewHolder.tv_dali_label_new.getText().toString().trim());
//        }else if (BaseResourceUtil.whetherResourceIDSame(viewId, R.id.tv_dali_alter_label)) {
//            //编辑
//            viewHolder.ll_dali_label_new_layout.setVisibility(View.GONE);
//            viewHolder.tv_dali_increase_label.setVisibility(View.GONE);
//            viewHolder.ll_dali_editor_label_layout.setVisibility(View.VISIBLE);
//            viewHolder.et_dali_editor_label.setText(viewHolder.tv_dali_label_new.getText().toString().trim());
//        } else if (BaseResourceUtil.whetherResourceIDSame(viewId, R.id.tv_dali_add_label)) {
//            //添加按钮点击（标签）
//            String editorLabel = viewHolder.et_dali_editor_label.getText().toString().trim();
//            if ("家".equals(editorLabel) || "公司".equals(editorLabel) || "学校".equals(editorLabel)) {
//                LKToastUtil.showToastShort("标签不能重名");
//            } else {
//                if (!TextUtils.isEmpty(editorLabel)) {
//                    viewHolder.ll_dali_label_new_layout.setVisibility(View.VISIBLE);
//                    viewHolder.tv_dali_increase_label.setVisibility(View.GONE);
//                    viewHolder.ll_dali_editor_label_layout.setVisibility(View.GONE);
//                } else {
//                    viewHolder.ll_dali_label_new_layout.setVisibility(View.GONE);
//                    viewHolder.tv_dali_increase_label.setVisibility(View.VISIBLE);
//                    viewHolder.ll_dali_editor_label_layout.setVisibility(View.GONE);
//                }
//                viewHolder.tv_dali_label_new.setText(editorLabel);
//                if(viewHolder.tv_dali_label_new.getCurrentTextColor() == ColorUtil.setBCColor(R.color.color_FE7235)){
//                    setAllLabelStyle(viewHolder.tv_dali_label_new.getText().toString().trim());
//                }
//                try {
//                    LKAppUtil.getInstance().closeInput(this, viewHolder.et_dali_editor_label);
//                } catch (Exception e) {
//                    LKLogUtil.e(e.getMessage(), e);
//                }
//            }
//        }
//
//
//    }
//
//
//    @Override
//    protected void initData(@Nullable Bundle data) {
//        super.initData(data);
//        try {
//            deliveryAddressBean = (DeliveryAddressBean) getIntent().getExtras().get(AddressEditorLogoKey);
//        } catch (Exception e) {
//            LKLogUtil.e(e.getMessage(), e);
//            deliveryAddressBean = null;
//        }
//        try {
//            manageOrSelectSkipLogo = getIntent().getExtras().getString(ManageOrSelectSkipLogoKey);
//        } catch (Exception e) {
//            LKLogUtil.e(e.getMessage(), e);
//            manageOrSelectSkipLogo = "";
//        }
//    }
//
//
//    @Override
//    protected void initAction(@Nullable Bundle data) {
//        super.initAction(data);
//        viewHolder.et_aoedaa_phone.setmHander(getHandler());
//        if (manageOrSelectSkipLogo.equals(ManageDeliveryAddressActivity.ManageDeliveryAddressActivityLogo_add)
//                || manageOrSelectSkipLogo.equals(ManageDeliveryAddressActivity.ManageDeliveryAddressActivityLogo_update)) {
//            viewHolder.tv_aoedaa_save_delivery_address.setText(getString(R.string.str_aoedaa_save_delivery_address));
//        } else if (manageOrSelectSkipLogo.equals(SelectDeliveryAddressActivity.SelectDeliveryAddressActivityLogo)) {
//            viewHolder.tv_aoedaa_save_delivery_address.setText(getString(R.string.str_aoedaa_save_and_use_delivery_address));
//        }
//        if (deliveryAddressBean == null) {
//            viewHolder.jtb_aoedaa_top_bar.getTv_ljtb_title().setText(getString(R.string.str_aoedaa_title_add));
//            deliveryAddressBean = new DeliveryAddressBean();
//        } else {
//            viewHolder.jtb_aoedaa_top_bar.getTv_ljtb_title().setText(getString(R.string.str_aoedaa_title_editor));
//            viewHolder.et_aoedaa_user_name.setText(deliveryAddressBean.getUserName());
//            viewHolder.et_aoedaa_phone.setText(StringProcessingUtil.stringRemoveBlankSpace(deliveryAddressBean.getPhone()));
//            viewHolder.et_aoedaa_city.setText(deliveryAddressBean.getCity());
//            viewHolder.et_aoedaa_address_detailed.setText(deliveryAddressBean.getAddress());
//            if (!TextUtils.isEmpty(deliveryAddressBean.getLabel())) {
//                setAllLabelStyle(deliveryAddressBean.getLabel());
//            }
//        }
//        /* 用户名称输入判断*/
//        viewHolder.et_aoedaa_user_name.addTextChangedListener(new TextWatcher() {
//            //监听前的文本
//            private CharSequence temp;
//            //光标开始位置
//            private int editStart;
//            //光标结束位置
//            private int editEnd;
//            private final int charMaxNum = 10;
//
//            @Override
//            public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
//                LKLogUtil.e("输入文本之前的状态");
//                temp = charSequence;
//            }
//
//            @Override
//            public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
//                LKLogUtil.e("输入文字中的状态");
//                if (i2 == 0) {
//                    return;
//                }
//                if (!viewHolder.et_aoedaa_user_name.getText().toString().equals(EditTextInputRuleUtil.stringNameFilter(viewHolder.et_aoedaa_user_name.getText().toString()))) {
//                    viewHolder.et_aoedaa_user_name.setText(EditTextInputRuleUtil.stringNameFilter(viewHolder.et_aoedaa_user_name.getText().toString()));
//                }
//                viewHolder.et_aoedaa_user_name.setSelection(viewHolder.et_aoedaa_user_name.getText().toString().length());
//            }
//
//            @Override
//            public void afterTextChanged(Editable editable) {
//                LKLogUtil.e("输入文字后的状态");
//                /** 得到光标开始和结束位置 ,超过最大数后记录刚超出的数字索引进行控制 */
//                editStart = viewHolder.et_aoedaa_user_name.getSelectionStart();
//                editEnd = viewHolder.et_aoedaa_user_name.getSelectionEnd();
//                if (temp.length() > charMaxNum) {
//                    LKToastUtil.showToastShort(getString(R.string.str_aoedaa_user_name_overrun));
//                    editable.delete(editStart - 1, editEnd);
//                    int tempSelection = editStart;
//                    viewHolder.et_aoedaa_user_name.setText(editable);
//                    viewHolder.et_aoedaa_user_name.setSelection(tempSelection);
//                }
//            }
//        });
//
//        /* 详细地址输入判断*/
//        viewHolder.et_aoedaa_address_detailed.addTextChangedListener(new TextWatcher() {
//            //监听前的文本
//            private CharSequence temp;
//            //光标开始位置
//            private int editStart;
//            //光标结束位置
//            private int editEnd;
//            private final int charMaxNum = 40;
//
//            @Override
//            public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
//                LKLogUtil.e("输入文本之前的状态");
//                temp = charSequence;
//            }
//
//            @Override
//            public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
//                LKLogUtil.e("输入文字中的状态");
//                if (i2 == 0) {
//                    return;
//                }
//                if (!TextUtils.isEmpty(EditTextInputRuleUtil.banInputEmoji(charSequence, i, i2))) {
//                    viewHolder.et_aoedaa_address_detailed.setText(EditTextInputRuleUtil.banInputEmoji(charSequence, i, i2));
//                }
//                viewHolder.et_aoedaa_address_detailed.setSelection(viewHolder.et_aoedaa_address_detailed.getText().toString().length());
//            }
//
//            @Override
//            public void afterTextChanged(Editable editable) {
//                LKLogUtil.e("输入文字后的状态");
//                /** 得到光标开始和结束位置 ,超过最大数后记录刚超出的数字索引进行控制 */
//                editStart = viewHolder.et_aoedaa_address_detailed.getSelectionStart();
//                editEnd = viewHolder.et_aoedaa_address_detailed.getSelectionEnd();
//                if (temp.length() > charMaxNum) {
//                    LKToastUtil.showToastShort(getString(R.string.str_aoedaa_address_detailed_overrun));
//                    editable.delete(editStart - 1, editEnd);
//                    int tempSelection = editStart;
//                    viewHolder.et_aoedaa_address_detailed.setText(editable);
//                    viewHolder.et_aoedaa_address_detailed.setSelection(tempSelection);
//                }
//            }
//        });
//
//        /* 添加新标签*/
//        viewHolder.et_dali_editor_label.addTextChangedListener(new TextWatcher() {
//            //监听前的文本
//            private CharSequence temp;
//            //光标开始位置
//            private int editStart;
//            //光标结束位置
//            private int editEnd;
//            private final int charMaxNum = 5;
//
//            @Override
//            public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
//                LKLogUtil.e("输入文本之前的状态");
//                temp = charSequence;
//            }
//
//            @Override
//            public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
//                LKLogUtil.e("输入文字中的状态");
//            }
//
//            @Override
//            public void afterTextChanged(Editable editable) {
//                LKLogUtil.e("输入文字后的状态");
//                /** 得到光标开始和结束位置 ,超过最大数后记录刚超出的数字索引进行控制 */
//                editStart = viewHolder.et_dali_editor_label.getSelectionStart();
//                editEnd = viewHolder.et_dali_editor_label.getSelectionEnd();
//                if (temp.length() > charMaxNum) {
//                    LKToastUtil.showToastShort(getString(R.string.str_aoedaa_address_type_overrun));
//                    editable.delete(editStart - 1, editEnd);
//                    int tempSelection = editStart;
//                    viewHolder.et_dali_editor_label.setText(editable);
//                    viewHolder.et_dali_editor_label.setSelection(tempSelection);
//                }
//            }
//        });
//
//        /*【第一个参数是activity，第二个是你选择后显示的TextView】*/
//        initAddressSelectView();
//
//        viewHolder.jtb_aoedaa_top_bar.setEventInterface(new BaseTopBarView.EventInterface() {
//            //返回按钮
//            @Override
//            public void leftOnClick() {
//                finishCurrent();
//            }
//
//            @Override
//            public void leftCloseClick() {
//
//            }
//
//            //选择联系人按钮
//            @Override
//            public void rightOnClick() {
//                boolean contact = LKPermissionUtil.getInstance().requestContacts(AddOrEditorDeliveryAddressActivity.this);
//                if (contact) {
//                    Intent intentContacts = new Intent();
//                    intentContacts.setAction(Intent.ACTION_PICK);
//                    intentContacts.setData(ContactsContract.Contacts.CONTENT_URI);
//                    startActivityForResult(intentContacts, 100);
//                }
//
//            }
//        });
//
//    }
//
//
//    private Dialog addressSelectDialog;
//
//    private void initAddressSelectView() {
//        ProvincesCitySelectView provincesCitySelectView = new ProvincesCitySelectView(this);
//        provincesCitySelectView.setOnViewClick(new ProvincesCitySelectView.OnViewClick() {
//            @Override
//            public void clickCancel() {
//                if (addressSelectDialog != null) {
//                    addressSelectDialog.hide();
//                }
//            }
//
//            @Override
//            public void clickSubmit(String provincialName, String municipalName, String countyName, String ids) {
//                if (addressSelectDialog != null) {
//                    addressSelectDialog.hide();
//                }
//                String address = "";
//                if (!TextUtils.isEmpty(provincialName)) {
//                    address = provincialName;
//                }
//                if (!TextUtils.isEmpty(municipalName)) {
//                    address += " " + municipalName;
//                }
//                if (!TextUtils.isEmpty(countyName)) {
//                    address += " " + countyName;
//                }
//                viewHolder.et_aoedaa_city.setText(address);
//            }
//        });
//        addressSelectDialog = LKDialogUtil.getBottomDialog(this, provincesCitySelectView);
//    }
//
//    /**
//     * 构建收货地址信息对象
//     */
//    private void buildDeliveryAddressBean() {
//        String phone = StringProcessingUtil.stringRemoveBlankSpace(viewHolder.et_aoedaa_phone.getText().toString());
//        deliveryAddressBean = DeliveryAddressRelatedServer.getInstance().getDeliveryAddressBean(deliveryAddressBean, viewHolder.et_aoedaa_user_name.getText().toString().trim(), phone
//                , viewHolder.et_aoedaa_city.getText().toString().trim(), viewHolder.et_aoedaa_address_detailed.getText().toString().trim());
//    }
//
//    @Override
//    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
//        super.onActivityResult(requestCode, resultCode, data);
//        switch (requestCode) {
//            case 100:
//
//                if (resultCode == RESULT_OK) {
//                    Uri contactData = data.getData();
//                    Cursor cursor = getContentResolver().query(contactData, null,
//                            null, null, null);
//                    //Key联系人姓名,Value联系人手机号
//                    Map<String, String> phoneMap = this.getContactPhone(cursor);
//                    if (!cursor.isClosed()) {
//                        cursor.close();
//                    }
//                    if (null != phoneMap && !phoneMap.isEmpty()) {
//                        Set<String> keySet = phoneMap.keySet();
//                        if (null != keySet && !keySet.isEmpty()) {
//                            Object[] keys = keySet.toArray();
//                            String phoneName = (String) keys[0];
//                            String phoneNo = phoneMap.get(phoneName);
//                            if (!TextUtils.isEmpty(phoneName) && phoneName.length() > 0) {
//                                phoneName = phoneName.substring(0, 10);
//                                LKToastUtil.showToastShort(getString(R.string.str_aoedaa_user_name_overrun));
//                            }
//                            viewHolder.et_aoedaa_user_name.setText(phoneName);
//                            if (!TextUtils.isEmpty(phoneNo)) {
//                                viewHolder.et_aoedaa_phone.setText(StringProcessingUtil.stringRemoveBlankSpace(phoneNo));
//                            }
//                        }
//                    }
//                }
//
//
////                //联系人回调
////                GetContactMsgUtil getContactMsgUtil;
////                try {
////                    getContactMsgUtil = new GetContactMsgUtil(mContext, data);
////                } catch (Exception e) {
////                    LKLogUtil.e(e.getMessage(), e);
////                    getContactMsgUtil = null;
////                }
////                if (getContactMsgUtil != null) {
////                    String name = "";
////                    if(getContactMsgUtil.getName() != null){
////                        name = getContactMsgUtil.getName();
////                    }
////                    String number = "";
////                    if(getContactMsgUtil.getPhone() != null){
////                        number = getContactMsgUtil.getPhone().replace("+86","");
////                    }
////                    LKLogUtil.e("result==" + name + "----" + number);
////                    if(LKCommonUtil.isPhone(number)){
////                        et_aoedaa_user_name.setText(name);
////                        et_aoedaa_phone.setText(StringProcessingUtil.stringRemoveBlankSpace(number));
////                    }
////                }
//                break;
//            default:
//                break;
//        }
//    }
//
//    /**
//     * 获取联系人姓名及手机号
//     *
//     * @param cursor
//     * @return Key为联系人姓名, Value为联系人手机号
//     */
//    private Map<String, String> getContactPhone(Cursor cursor) {
//        Map<String, String> resultMap = new HashMap<String, String>();
//        String phoneName = null;// 姓名
//        String mobilePhoneNo = null;// 手机号
//
//        if (null != cursor) {
//            cursor.moveToFirst();
//
//            // 获得联系人的ID号
//            int idFieldIndex = cursor
//                    .getColumnIndex(ContactsContract.Contacts._ID);
//            String contactId = cursor.getString(idFieldIndex);
//            // 联系人姓名
//            int idphoneNameIndex = cursor
//                    .getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME);
//            phoneName = cursor.getString(idphoneNameIndex);
//
//            // 获得联系人的电话号码的cursor;
//            Cursor allPhones = getContentResolver().query(
//                    ContactsContract.CommonDataKinds.Phone.CONTENT_URI, null,
//                    ContactsContract.CommonDataKinds.Phone.CONTACT_ID + "=?",
//                    new String[]{contactId}, null);
//
//            // 所以联系电话（包话电话和手机号）
//            List<String> allPhoneNumList = new ArrayList<String>();
//            if (allPhones.moveToFirst()) {
//
//                // 遍历所有的电话号码
//                for (; !allPhones.isAfterLast(); allPhones.moveToNext()) {
//                    int telNoTypeIndex = allPhones
//                            .getColumnIndex(ContactsContract.CommonDataKinds.Phone.TYPE);
//                    int telNoType = allPhones.getInt(telNoTypeIndex);
//
//                    int telNoIndex = allPhones
//                            .getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER);
//                    String telNo = allPhones.getString(telNoIndex);
//                    allPhoneNumList.add(telNo);
//
//                    if (2 == telNoType) {// 手机号（原生态的SDK定义：mobile是2，home是1，work是3，other是7）
//                        mobilePhoneNo = telNo;
//                        break;
//                    }
//                }
//                if (!allPhones.isClosed()) {
//                    allPhones.close();
//                }
//
//                if (null == mobilePhoneNo) {// 没有存贮手机号
//                    if (!allPhoneNumList.isEmpty()) {// 存在其它号码
//                        for (String tel : allPhoneNumList) {
//                            if (LKCommonUtil.isPhone(tel)) {// 取属于手机号格式
//                                mobilePhoneNo = tel;
//                                break;
//                            }
//                        }
//                    }
//                }
//            }
//            if (!cursor.isClosed()) {
//                cursor.close();
//            }
//
//            resultMap.put(phoneName, mobilePhoneNo);
//        }
//        return resultMap;
//    }
//
//    /**
//     * 设置所有标签样式
//     */
//    public void setAllLabelStyle(String selectLabel) {
//        viewHolder.tv_dali_label_home.setBackgroundResource(R.drawable.delivery_address_label_shape);
//        viewHolder.tv_dali_label_home.setTextColor(ColorUtil.setBCColor(R.color.color_59030303));
//        viewHolder.tv_dali_label_company.setBackgroundResource(R.drawable.delivery_address_label_shape);
//        viewHolder.tv_dali_label_company.setTextColor(ColorUtil.setBCColor(R.color.color_59030303));
//        viewHolder.tv_dali_label_school.setBackgroundResource(R.drawable.delivery_address_label_shape);
//        viewHolder.tv_dali_label_school.setTextColor(ColorUtil.setBCColor(R.color.color_59030303));
//        viewHolder.tv_dali_label_new.setBackgroundResource(R.drawable.delivery_address_new_label_shape);
//        viewHolder.tv_dali_label_new.setTextColor(ColorUtil.setBCColor(R.color.color_59030303));
//        if (!TextUtils.isEmpty(selectLabel)) {
//            deliveryAddressBean.setLabel(selectLabel);
//            if (selectLabel.equals(viewHolder.tv_dali_label_home.getText().toString().trim())) {
//                viewHolder.tv_dali_label_home.setBackgroundResource(R.drawable.delivery_address_add_label_shape);
//                viewHolder.tv_dali_label_home.setTextColor(ColorUtil.setBCColor(R.color.color_28BFA9));
//            } else if (selectLabel.equals(viewHolder.tv_dali_label_company.getText().toString().trim())) {
//                viewHolder.tv_dali_label_company.setBackgroundResource(R.drawable.delivery_address_add_label_shape);
//                viewHolder.tv_dali_label_company.setTextColor(ColorUtil.setBCColor(R.color.color_28BFA9));
//            } else if (selectLabel.equals(viewHolder.tv_dali_label_school.getText().toString().trim())) {
//                viewHolder.tv_dali_label_school.setBackgroundResource(R.drawable.delivery_address_add_label_shape);
//                viewHolder.tv_dali_label_school.setTextColor(ColorUtil.setBCColor(R.color.color_28BFA9));
//            } else {
//                viewHolder.tv_dali_label_new.setBackgroundResource(R.drawable.delivery_address_select_new_label_shape);
//                viewHolder.tv_dali_label_new.setTextColor(ColorUtil.setBCColor(R.color.color_28BFA9));
//                viewHolder.tv_dali_label_new.setText(selectLabel);
//                viewHolder.ll_dali_label_new_layout.setVisibility(View.VISIBLE);
//                viewHolder.tv_dali_increase_label.setVisibility(View.GONE);
//                viewHolder.ll_dali_editor_label_layout.setVisibility(View.GONE);
//            }
//        } else {
//            viewHolder.tv_dali_label_new.setText("");
//            viewHolder.ll_dali_label_new_layout.setVisibility(View.GONE);
//            viewHolder.tv_dali_increase_label.setVisibility(View.VISIBLE);
//            viewHolder.ll_dali_editor_label_layout.setVisibility(View.GONE);
//        }
//    }
//
//    /**
//     * 新增收货地址
//     */
//    private void addAddress() {
//        CommonDeliveryAddressRequestObj commonDeliveryAddressRequestObj = new CommonDeliveryAddressRequestObj();
//        //此处需要确定已经登录了，才可以访问该接口（默认的userid和token不一定登录过，这里使用某个已登录的数据，全项目运行时不需要）
//        commonDeliveryAddressRequestObj.setAddressName(deliveryAddressBean.getUserName());
//        commonDeliveryAddressRequestObj.setAddressPhone(deliveryAddressBean.getPhone());
//        String simple_address = deliveryAddressBean.getCity();
//        String[] simple_addresses = simple_address.split(" ");
//        commonDeliveryAddressRequestObj.setAddressProvince(simple_addresses[0]);
//        commonDeliveryAddressRequestObj.setAddressCity(simple_addresses[1]);
//        commonDeliveryAddressRequestObj.setAddressArea(simple_addresses[2]);
//        commonDeliveryAddressRequestObj.setAddressDetailed(deliveryAddressBean.getAddress());
//        if (!TextUtils.isEmpty(deliveryAddressBean.getLabel())) {
//            commonDeliveryAddressRequestObj.setAddressTag(deliveryAddressBean.getLabel());
//        }
//        //当为第一条数据时，为默认；后面添加的数据为非默认
//        //默认地址  0默认，1非默认
//        if (DeliveryAddressRelatedServer.getInstance().getDeliveryAddressList().size() > 0) {
//            commonDeliveryAddressRequestObj.setAddressDefaultChoose("1");
//        } else {
//            commonDeliveryAddressRequestObj.setAddressDefaultChoose("0");
//        }
//        BaseHttpRequest.postRequest(BaseLibNetworkInterface.ADD_ADDRESS, commonDeliveryAddressRequestObj,
//                AddDeliveryAddressResponseObj.class, true);
//    }
//
//    /**
//     * 修改收货地址
//     */
//    private void updateAddress() {
//        CommonDeliveryAddressRequestObj commonDeliveryAddressRequestObj = new CommonDeliveryAddressRequestObj();
//        //此处需要确定已经登录了，才可以访问该接口（默认的userid和token不一定登录过，这里使用某个已登录的数据，全项目运行时不需要）
//        commonDeliveryAddressRequestObj.setId(deliveryAddressBean.getId());
//        commonDeliveryAddressRequestObj.setAddressName(deliveryAddressBean.getUserName());
//        commonDeliveryAddressRequestObj.setAddressPhone(deliveryAddressBean.getPhone());
//        String simple_address = deliveryAddressBean.getCity();
//        String[] simple_addresses = simple_address.split(" ");
//        commonDeliveryAddressRequestObj.setAddressProvince(simple_addresses[0]);
//        commonDeliveryAddressRequestObj.setAddressCity(simple_addresses[1]);
//        commonDeliveryAddressRequestObj.setAddressArea(simple_addresses[2]);
//        commonDeliveryAddressRequestObj.setAddressDetailed(deliveryAddressBean.getAddress());
//        if (!TextUtils.isEmpty(deliveryAddressBean.getLabel())) {
//            commonDeliveryAddressRequestObj.setAddressTag(deliveryAddressBean.getLabel());
//        }
//        BaseHttpRequest.postRequest(BaseLibNetworkInterface.UPDATE_ADDRESS, commonDeliveryAddressRequestObj,
//                UpdateDeliveryAddressResponseObj.class, true);
//    }
//
//
//    @Override
//    protected void getData(BaseResponseObj obj) {
//        super.getData(obj);
//        //新增收货地址
//        if (obj instanceof AddDeliveryAddressResponseObj) {
//            LKLogUtil.e("=======新增收货地址成功");
//            LKToastUtil.showToastShort("新增收货地址成功");
//            DeliveryAddressRelatedServer.getInstance().saveDeliveryAddressInfo(deliveryAddressBean);
//            finishCurrent();
//        }
//        //修改收货地址
//        if (obj instanceof UpdateDeliveryAddressResponseObj) {
//            LKLogUtil.e("=======修改收货地址成功");
//            LKToastUtil.showToastShort("修改收货地址成功");
//            DeliveryAddressRelatedServer.getInstance().saveDeliveryAddressInfo(deliveryAddressBean);
//            finishCurrent();
//        }
//    }
//
//
//    private void finishCurrent() {
//        LKAppUtil.getInstance().closeInput(this, viewHolder.et_aoedaa_user_name);
//        finish();
//    }
//
//
//}
